const getType = (s) => {
  const r = Object.prototype.toString.call(s);

  return r.replace(/\[object (.*?)\]/, "$1").toLowerCase();
};

// 测试
console.log(getType()); // undefined
console.log(getType(null)); // null
console.log(getType(1)); // number
console.log(getType("前端胖头鱼")); // string
console.log(getType(true)); // boolean
console.log(getType(Symbol("前端胖头鱼"))); // symbol
console.log(getType({})); // object
console.log(getType([])); // array
